package org.example.project.bookstore.test;

import jakarta.annotation.Resource;
import lombok.extern.slf4j.Slf4j;
import org.example.bean.Logistics;
import org.example.bean.User;
import org.example.project.bookstore.service.LogisticsService;
import org.example.project.bookstore.service.UserService;
import org.example.util.JsonResult;
import org.junit.jupiter.api.Test;
import org.springframework.boot.test.context.SpringBootTest;

/**
 * @Auther:Liu
 * @Testname:App
 * @Date:2025/8/25 16:33
 */
@Slf4j
@SpringBootTest
public class App {
    @Resource
    private UserService userService;

    @Resource
    private LogisticsService logisticsService;
   @Test
    public void a(){
       User user = new User();
       user.setUsername("admin");
       user.setPassword("123456");
       JsonResult login = userService.login(user);
       log.info("login:{}",login);
   }

   @Test
   public void b(){
       String token="eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJpc3MiOiJhZG1pbiIsInN1YiI6ImRhaWx5Ymx1ZSIsImlhdCI6MTc1NjExMTM4MiwiZXhwIjoxNzU2MTk3NzgyLCJpZCI6IjE1MjEyOTQ4NzIzMzAzOTE1NTUiLCJuYW1lIjoiYWRtaW4ifQ.N5E580DZLoJuTAKcM9zF3LnP1qZyCvJUlwhPSmibl44";
       JsonResult userId = logisticsService.findUserId(token);
       log.info("userId:{}",userId);

   }
   @Test
   public void c(){
       String token = "eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJpc3MiOiJhZG1pbiIsInN1YiI6ImRhaWx5Ymx1ZSIsImlhdCI6MTc1NjEwODkzMCwiZXhwIjoxNzU2MTk1MzMwLCJpZCI6IjE1MjEyOTQ4NzIzMzAzOTE1NTUiLCJuYW1lIjoiYWRtaW4ifQ.BumoTeTGrkdpqKhqTZ9m8oGG6ZelRgpIt18e_Gi_lqg";
       Logistics logistics = new Logistics();
       logistics.setLogisticsAddress("陕西省西安市雁塔区长安南路199号");
       logistics.setLogisticsName("张三");
       logistics.setLogisticsPhone("19987652345");
       logistics.setStatus(1);
       JsonResult result = logisticsService.saveLogistics(logistics, token);
       log.info("result:{}", result);
   }
}
